﻿<r:RibbonWindow 
    x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
    xmlns:southridge="clr-namespace:Southridge.Controls;assembly=Southridge.Controls"
    xmlns:Views="clr-namespace:Xceed.Wpf.DataGrid.Views;assembly=Xceed.Wpf.DataGrid"
    xmlns:av="clr-namespace:Avalon.Windows.Controls;assembly=AvalonLibrary"
    xmlns:me="clr-namespace:Co9320.NamaAlert"
    xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
    xmlns:Converter="clr-namespace:Co9320.NamaAlert.Converter"
    Icon="Icons/application.ico"
    Title="{Binding LivePrograms.Count, StringFormat=0 - ニコ生アラート}"
    Background="#FFBFDBFF"
    Width="{Binding UISettings.Width}" Height="{Binding UISettings.Height}"
    Topmost="{Binding UISettings.Topmost}"
    >


    
    <Window.Resources>
        <Converter:NegationConverter x:Key="NegationConverter"/>
        <Converter:GroupToImageConverter x:Key="GroupToImageConverter"/>
        
        <!--<Style TargetType="{x:Type xcdg:DataRow}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding Path=IsMemberOnly}" Value="True">
                    <Setter Property="Background" Value="Pink"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>-->


        <DataTemplate x:Key="LiveProgramMenuItemIconTemplate">
            <TextBlock Text="{Binding Title}" />
            <!--<MenuItem>
                <MenuItem.ItemTemplate>
                    <DataTemplate>
                        <MenuItem Header="{Binding Title}">
                            <MenuItem.Icon>
                                <Image Source="{Binding Station.Icon}" Height="16"/>
                            </MenuItem.Icon>
                        </MenuItem>
                    </DataTemplate>
                </MenuItem.ItemTemplate>
            </MenuItem>-->
        </DataTemplate>
  
        
    </Window.Resources>
    <DockPanel>
        <r:Ribbon 
            x:Name="Ribbon"
            DockPanel.Dock="Top" Title="{Binding Path=LivePrograms.Count}">
            <r:Ribbon.Resources>
                <r:RibbonCommand x:Key="ShowTopmostCommand"
                                 LabelTitle="最前面"
                                 Executed="ShowTopmostRibbonCommand_Executed"
                                 LargeImageSource="Images/pin.png"
                                 SmallImageSource="Images/pin_small.png" />

                <r:RibbonCommand x:Key="SearchRibbonCommand"
                                 LabelTitle="検索"
                                 Executed="SearchRibbonCommand_Executed"
                                 LargeImageSource="Images/binocular.png"
                                 SmallImageSource="Images/binocular_small.png" />
                <r:RibbonCommand x:Key="ShowTagsRibbonCommand"
                                 LabelTitle="タグ"
                                 
                                 LargeImageSource="Images/tag.png"
                                 SmallImageSource="Images/tag_small.png" />
                <r:RibbonCommand x:Key="ShowColumnRibbonCommand"
                                 LabelTitle="カラム"
                                 Executed="ShowColumnRibbonCommand_Executed"
                                 LargeImageSource="Images/table_small.png"
                                 SmallImageSource="Images/table_small.png" />
                <r:RibbonCommand x:Key="ShutdownRibbonCommand"
                                 LabelTitle="終了"
                                 Executed="Shutdown_Executed"
                                  />
            </r:Ribbon.Resources>
            
            <r:Ribbon.ApplicationMenu>
                <r:RibbonApplicationMenu>
                    <r:RibbonApplicationMenuItem Command="{StaticResource SearchRibbonCommand}" />
                    <r:RibbonApplicationMenuItem Command="{StaticResource ShutdownRibbonCommand}" />
                </r:RibbonApplicationMenu>
            </r:Ribbon.ApplicationMenu>

            <r:Ribbon.QuickAccessToolBar>
                <r:RibbonQuickAccessToolBar>
                    <r:RibbonToggleButton Command="{StaticResource SearchRibbonCommand}" r:RibbonQuickAccessToolBar.Placement="InCustomizeMenuAndToolBar" />
                    <r:RibbonToggleButton Command="{StaticResource ShowTagsRibbonCommand}" r:RibbonQuickAccessToolBar.Placement="InCustomizeMenu" />
                </r:RibbonQuickAccessToolBar>
            </r:Ribbon.QuickAccessToolBar>
            
            <r:RibbonTab Label="ホーム">

                <r:RibbonGroup>
                    <r:RibbonGroup.Command>
                        <r:RibbonCommand LabelTitle="" />
                    </r:RibbonGroup.Command>

                    <r:RibbonDropDownButton>
                        <r:RibbonDropDownButton.Command>
                            <r:RibbonCommand 
                                LabelTitle="履歴"
                                LargeImageSource="Images/bell.png"
                                SmallImageSource="Images/bell_small.png"/>
                        </r:RibbonDropDownButton.Command>
                    </r:RibbonDropDownButton>

                </r:RibbonGroup>
                
                <r:RibbonGroup>
                    <r:RibbonGroup.Command>
                        <r:RibbonCommand LabelTitle="表示" />
                    </r:RibbonGroup.Command>
                    <r:RibbonGroup.GroupSizeDefinitions>
                        <r:RibbonGroupSizeDefinitionCollection>
                            <r:RibbonGroupSizeDefinition>
                                <r:RibbonControlSizeDefinition ImageSize="Large"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Large"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Large"
                                                     IsLabelVisible="True"/>
                            </r:RibbonGroupSizeDefinition>
                            <r:RibbonGroupSizeDefinition IsCollapsed="True"/>
                        </r:RibbonGroupSizeDefinitionCollection>
                    </r:RibbonGroup.GroupSizeDefinitions>

                    <r:RibbonToggleButton Command="{StaticResource SearchRibbonCommand}" IsChecked="{Binding UISettings.ShowSearchBar}" />
                    <r:RibbonToggleButton Command="{StaticResource ShowTagsRibbonCommand}" IsChecked="{Binding UISettings.ShowSearchBar}" />

                    <r:RibbonDropDownButton Command="{StaticResource ShowColumnRibbonCommand}">
                        <MenuItem Header="アイコン" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.IconVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <MenuItem Header="タイトル" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.TitleVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <MenuItem Header="放送局" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.StationNameVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <MenuItem Header="放送者" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.CasterVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <MenuItem Header="開始時間" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.StartDateTimeVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <MenuItem Header="来場者数" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.VisitorCountVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <MenuItem Header="コメ数" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.CommentCountVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <MenuItem Header="公式タグ" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.OfficialTagVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <MenuItem Header="詳細" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.ShortContentVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <MenuItem Header="評価" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.RatingVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <MenuItem Header="通知設定" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.AlertSettingsVisible}" Command="{StaticResource ShowColumnRibbonCommand}" />
                        <Separator />
                        <MenuItem Header="すべて表示" Command="{Binding UISettings.DataGrid.ShowAllColumnsCommand}"  />
                    </r:RibbonDropDownButton>

                    <r:RibbonDropDownButton>
                        <r:RibbonDropDownButton.Command>
                            <r:RibbonCommand LabelTitle="評価"
                                             Executed="RibbonCommand_Executed"
                                             LargeImageSource="Images/star_small.png"
                                             SmallImageSource="Images/star_small.png" />
                        </r:RibbonDropDownButton.Command>
                        <MenuItem Header="星5" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar5, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" />
                        <MenuItem Header="星4" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar4, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}"/>
                        <MenuItem Header="星3" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar3, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}"/>
                        <MenuItem Header="星2" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar2, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}"/>
                        <MenuItem Header="星1" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar1, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}"/>
                        <MenuItem Header="評価なし" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar0, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" />
                        <Separator />
                        <MenuItem Header="すべて表示" IsCheckable="False" Command="{Binding UISettings.ResetFilterByStarCommand}" />
                    </r:RibbonDropDownButton>
                    <r:RibbonDropDownButton>
                        <r:RibbonDropDownButton.Command>
                            <r:RibbonCommand LabelTitle="フィルタ"
                                             LargeImageSource="Images/funnel_small.png"
                                             SmallImageSource="Images/funnel_small.png" />
                        </r:RibbonDropDownButton.Command>
                        <MenuItem Header="チャンネル" IsCheckable="True" IsChecked="True" />
                        <MenuItem Header="コミュニティ" IsCheckable="True" IsChecked="True" />
                        <MenuItem Header="限定" IsCheckable="True" IsChecked="True" />
                        <MenuItem Header="顔出し" IsCheckable="True" IsChecked="True" />
                        <Separator />
                        <MenuItem Header="通知対象" IsCheckable="True" IsChecked="True" />
                        <MenuItem Header="オンエア" IsCheckable="True" IsChecked="True" />
                        <MenuItem Header="オフエア" IsCheckable="True" IsChecked="True" />
                        <Separator />
                        <MenuItem Header="ほげ" IsCheckable="True" IsChecked="True" />
                    </r:RibbonDropDownButton>
                    <r:RibbonDropDownButton>
                        <r:RibbonDropDownButton.Command>
                            <r:RibbonCommand LabelTitle="グループ"
                                             Executed="RibbonCommand_Executed"
                                             LargeImageSource="Images/group.png"
                                             SmallImageSource="Images/group_small.png" />
                        </r:RibbonDropDownButton.Command>
                        <MenuItem Header="なし" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="None">
                            <MenuItem.Icon>
                                <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=None, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="チャンネル/ユーザー放送" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="Station">
                            <MenuItem.Icon>
                                <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=Station, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="公式タグ" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="OfficialTag">
                            <MenuItem.Icon>
                                <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=OfficialTag, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="公開/限定" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="MemberOnly">
                            <MenuItem.Icon>
                                <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=MemberOnly, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="顔出し" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="Face">
                            <MenuItem.Icon>
                                <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=Face, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="評価" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="Rating">
                            <MenuItem.Icon>
                                <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=Rating, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                            </MenuItem.Icon>
                        </MenuItem>
                        <Separator />
                        <MenuItem Header="アラートした放送をまとめる" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.GroupByAlertedProgram}" />
                        <MenuItem Header="通知対象の放送局をまとめる" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.GroupByAlertTarget}" />
                        <MenuItem Header="オフエアの放送局をまとめる" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.GroupByOffair}" />
                    </r:RibbonDropDownButton>

                </r:RibbonGroup>
                
                <r:RibbonGroup>
                    <r:RibbonGroup.Command>
                        <r:RibbonCommand LabelTitle="" />
                    </r:RibbonGroup.Command>

                    <!-- 最前面 -->
                    <r:RibbonToggleButton Command="{StaticResource ShowTopmostCommand}" IsChecked="{Binding UISettings.Topmost}" />
                </r:RibbonGroup>

                <r:RibbonGroup>
                    <r:RibbonGroup.Command>
                        <r:RibbonCommand LabelTitle="情報" />
                    </r:RibbonGroup.Command>
                    <r:RibbonButton>
                        <r:RibbonButton.Command>
                            <r:RibbonCommand 
                                LabelTitle="リンク"
                                LargeImageSource="Images/link.png"
                                SmallImageSource="Images/link_small.png"/>
                        </r:RibbonButton.Command>
                    </r:RibbonButton>
                    <r:RibbonButton>
                        <r:RibbonButton.Command>
                            <r:RibbonCommand 
                                LabelTitle="ヘルプ"
                                LargeImageSource="Images/help.png" />
                        </r:RibbonButton.Command>
                    </r:RibbonButton>
                </r:RibbonGroup>

            </r:RibbonTab>

            
            <r:RibbonTab Label="通知">
                <!-- 履歴 -->
                <r:RibbonGroup>
                    <r:RibbonGroup.Command>
                        <r:RibbonCommand LabelTitle="操作" />
                    </r:RibbonGroup.Command>
                    
                    <!--<r:RibbonGroup.GroupSizeDefinitions>
                        <r:RibbonGroupSizeDefinitionCollection>
                            <r:RibbonGroupSizeDefinition>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                            </r:RibbonGroupSizeDefinition>
                            <r:RibbonGroupSizeDefinition IsCollapsed="True"/>
                        </r:RibbonGroupSizeDefinitionCollection>
                    </r:RibbonGroup.GroupSizeDefinitions>-->

                    <r:RibbonButton>
                        <r:RibbonButton.Command>
                            <r:RibbonCommand 
                                LabelTitle="追加"
                                LargeImageSource="Images/bell-plus_small.png"
                                SmallImageSource="Images/bell-plus_small.png"/>
                        </r:RibbonButton.Command>
                    </r:RibbonButton>
                    
                    <r:RibbonToggleButton  IsEnabled="False"
                        IsChecked="{Binding UISettings.ShowSearchBar}">
                        <r:RibbonToggleButton.Command>
                            <r:RibbonCommand LabelTitle="ミュート"
                                         Executed="SearchRibbonCommand_Executed"
                                         LargeImageSource="Images/mute.png"
                                         SmallImageSource="Images/mute_small.png" />
                        </r:RibbonToggleButton.Command>
                    </r:RibbonToggleButton>


                    
                </r:RibbonGroup>

                <!-- 通知方法 -->
                <r:RibbonGroup>
                    <r:RibbonGroup.Command>
                        <r:RibbonCommand LabelTitle="通知方法" />
                    </r:RibbonGroup.Command>
                    
                    <r:RibbonGroup.GroupSizeDefinitions>
                        <r:RibbonGroupSizeDefinitionCollection>
                            <r:RibbonGroupSizeDefinition>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                                <r:RibbonControlSizeDefinition ImageSize="Small"
                                                     IsLabelVisible="True"/>
                            </r:RibbonGroupSizeDefinition>
                            <r:RibbonGroupSizeDefinition IsCollapsed="True"/>
                        </r:RibbonGroupSizeDefinitionCollection>
                    </r:RibbonGroup.GroupSizeDefinitions>

                    <r:RibbonToggleButton IsEnabled="False"
                        IsChecked="{Binding UISettings.ShowSearchBar}">
                        <r:RibbonToggleButton.Command>
                            <r:RibbonCommand LabelTitle="ウィンドウ"
                                         Executed="SearchRibbonCommand_Executed"
                                         LargeImageSource="Images/window_small.png"
                                         SmallImageSource="Images/window_small.png" />
                        </r:RibbonToggleButton.Command>
                    </r:RibbonToggleButton>
                    <r:RibbonToggleButton IsEnabled="False"
                        IsChecked="{Binding UISettings.ShowSearchBar}">
                        <r:RibbonToggleButton.Command>
                            <r:RibbonCommand LabelTitle="バルーン"
                                         Executed="SearchRibbonCommand_Executed"
                                         LargeImageSource="Images/balloon_small.png"
                                         SmallImageSource="Images/balloon_small.png" />
                        </r:RibbonToggleButton.Command>
                    </r:RibbonToggleButton>
                    <r:RibbonToggleButton IsEnabled="False"
                        IsChecked="{Binding UISettings.ShowSearchBar}">
                        <r:RibbonToggleButton.Command>
                            <r:RibbonCommand LabelTitle="ブラウザー"
                                         Executed="SearchRibbonCommand_Executed"
                                         LargeImageSource="Images/browser_small.png"
                                         SmallImageSource="Images/browser_small.png" />
                        </r:RibbonToggleButton.Command>
                    </r:RibbonToggleButton>
                    <r:RibbonToggleButton IsEnabled="False"
                        IsChecked="{Binding UISettings.ShowSearchBar}">
                        <r:RibbonToggleButton.Command>
                            <r:RibbonCommand LabelTitle="メール"
                                         Executed="SearchRibbonCommand_Executed"
                                         LargeImageSource="Images/mail_small.png"
                                         SmallImageSource="Images/mail_small.png" />
                        </r:RibbonToggleButton.Command>
                    </r:RibbonToggleButton>
                    
                    
                    <r:RibbonSplitButton  IsEnabled="False">
                        <r:RibbonSplitButton.Command>
                             <r:RibbonCommand LabelTitle="サウンド"
                                     Executed="SearchRibbonCommand_Executed"
                                     LargeImageSource="Images/sound_small.png"
                                     SmallImageSource="Images/sound_small.png" />
                        </r:RibbonSplitButton.Command>
                        <r:RibbonSplitButton.Items>
                            <r:RibbonToggleButton
                                r:RibbonSplitButton.IsRibbonSplitButtonHighlighted="True"
                                IsChecked="{Binding UISettings.ShowSearchBar}">
                                <r:RibbonToggleButton.Command>
                                    <r:RibbonCommand LabelTitle="メール"
                                         Executed="SearchRibbonCommand_Executed"
                                         LargeImageSource="Images/mail_small.png"
                                         SmallImageSource="Images/mail_small.png" />
                                </r:RibbonToggleButton.Command>
                            </r:RibbonToggleButton>
                        </r:RibbonSplitButton.Items>
                        <!--<r:RibbonSplitButton.Command>
                            
                            <r:RibbonCommand LabelTitle="サウンド"
                                         Executed="SearchRibbonCommand_Executed"
                                         LargeImageSource="Images/sound_small.png"
                                         SmallImageSource="Images/sound_small.png" />
                        </r:RibbonSplitButton.Command>-->
                    </r:RibbonSplitButton>
                    <!--<r:RibbonDropDownButton>
                        <r:RibbonDropDownButton.Command>
                            <r:RibbonCommand LabelTitle="評価"
                                             Executed="RibbonCommand_Executed"
                                             LargeImageSource="Images/star_small.png"
                                             SmallImageSource="Images/star_small.png" />
                        </r:RibbonDropDownButton.Command>
                        <MenuItem Header="星5" IsCheckable="True" IsChecked="True" />
                        <MenuItem Header="星4" IsCheckable="True" IsChecked="True" />
                        <MenuItem Header="星3" IsCheckable="True" IsChecked="True" />
                        <MenuItem Header="星2" IsCheckable="True" IsChecked="True" />
                        <MenuItem Header="星1" IsCheckable="True" IsChecked="True" />
                        <MenuItem Header="評価なし" IsCheckable="True" IsChecked="True" />
                        <Separator />
                        <MenuItem Header="すべて表示" IsCheckable="False"  />
                    </r:RibbonDropDownButton>-->

                </r:RibbonGroup>

                <!-- キーワード -->
                <r:RibbonGroup>
                    <r:RibbonGroup.Command>
                        <r:RibbonCommand LabelTitle="" />
                    </r:RibbonGroup.Command>

                    <r:RibbonButton>
                        <r:RibbonButton.Command>
                            <r:RibbonCommand 
                                LabelTitle="キーワード"
                                LargeImageSource="Images/bell.png"
                                SmallImageSource="Images/bell_small.png"/>
                        </r:RibbonButton.Command>
                    </r:RibbonButton>

                </r:RibbonGroup>
            </r:RibbonTab>
        </r:Ribbon>

        <!-- 検索 -->
        <Grid DockPanel.Dock="Top"
              x:Name="SearchBarGrid"
              Visibility="{Binding Path=UISettings.ShowSearchBar, Converter={StaticResource BooleanToVisibilityConverter}}"
              Margin="3" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Image Source="Images/binocular_small.png" Style="{StaticResource SmallIconStyle}" VerticalAlignment="Center" Margin="3 0 3 0"  />
            <TextBox Grid.Column="1"
                     Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
                     Margin="3"
                     HorizontalAlignment="Stretch"
                     me:TextBoxBehavior.Command="{Binding SearchCommand}" />
        </Grid>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition Height="Auto" MinHeight="3" />
                <RowDefinition MinHeight="30" Height="120" />
            </Grid.RowDefinitions>

            <DockPanel>
                <xcdg:DataGridControl
                    x:Name="LiveProgramDataGrid"
                    
                    EditTriggers="SingleClick"
                    CellEditorDisplayConditions="MouseOverCell"
                    Width="{Binding ElementName=Ribbon, Path=ActualWidth}"
                    ItemsSource="{Binding LiveProgramsViewSource.View}" 
                    AutoCreateColumns="False"
                    NavigationBehavior="RowOrCell"  
                    
                    ItemScrollingBehavior="Immediate">

                    <xcdg:DataGridControl.Resources>
                        <Style x:Key="{x:Type xcdg:ScrollTip}" TargetType="xcdg:ScrollTip">
                            <Setter Property="HorizontalAlignment" Value="Right" />
                            <Setter Property="VerticalAlignment" Value="Center" />
                        </Style>
                        <Style TargetType="{x:Type xcdg:DataRow}">
                            <Setter Property="ContextMenu" Value="{StaticResource ProgramsRowContextMenu}" />
                        </Style>


                    </xcdg:DataGridControl.Resources>
                    
                    <xcdg:DataGridControl.Columns>

                        <xcdg:Column FieldName="Icon" x:Name="IconColumn"
                                     ReadOnly="True"
                                     Title=""
                                     CellContentTemplate="{StaticResource StationIconCellTemplate}"                                     
                                     Width="{Binding UISettings.DataGrid.IconWidth}"
                                      />
                        <xcdg:Column FieldName="Subset" x:Name="TitleColumn"
                                     ReadOnly="True"
                                     Title="タイトル" 
                                     IsMainColumn="True"
                                     CellContentTemplate="{StaticResource TitleCellTemplate}"
                                     />
                        <xcdg:Column FieldName="Station.Name" x:Name="StationNameColumn"
                                     ReadOnly="True"
                                     Title="放送局" />
                        <xcdg:Column FieldName="Caster" x:Name="CasterColumn"
                                     ReadOnly="True"
                                     Title="放送者" />
                        <xcdg:Column FieldName="StartDateTime" x:Name="StartDateTimeColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource StartDateTimeCellTemplate}"
                                     Title="開始時間" />
                        <!--<xcdg:Column FieldName="ElapsedTime" x:Name="ElapsedTimeColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource ElapsedTimeCellTemplate}"
                                     Title="経過時間" />-->
                        <xcdg:Column FieldName="VisitorCount" x:Name="VisitorCountColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource VisitorCountCellTemplate}"
                                     Title="来場者数" />
                        <xcdg:Column FieldName="CommentCount" x:Name="CommentCountColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource CommentCountCellTemplate}"
                                     Title="コメ数" />
                        <xcdg:Column FieldName="OfficialTag" x:Name="OfficialTagColumn"
                                     ReadOnly="True"
                                     Title="公式タグ" />
                        <xcdg:Column FieldName="ShortContent" x:Name="ShortContentColumn"
                                     ReadOnly="True"
                                     Title="詳細" />
                        <xcdg:Column FieldName="Station" x:Name="RatingColumn"
                                     ReadOnly="False"
                                     CellContentTemplate="{StaticResource RatingCellTemplate}"
                                     CellEditor="{StaticResource RatingCellEditor}"
                                     Title="評価"
                                     />
                        <xcdg:Column FieldName="Station.AlertSettings" x:Name="AlertSettingsColumn"
                                     ReadOnly="False"
                                     CellContentTemplate="{StaticResource AlertSettingsCellTemplate}"
                                     CellEditor="{StaticResource AlertSettingsCellEditor}"
                                     Title="通知設定" />

                        <xcdg:Column FieldName="IsMemberOnly" x:Name="MemberOnlyColumn"
                                     CellContentTemplate="{StaticResource MemberOnlyCellTemplate}"
                                     ReadOnly="True"
                                     Visible="False"
                                     Title="公開" />
                        <xcdg:Column FieldName="IsFace" x:Name="FaceColumn"
                                     CellContentTemplate="{StaticResource FaceCellTemplate}"
                                     ReadOnly="True"
                                     Visible="False"
                                     Title="顔出し" />
                        
                        <xcdg:Column FieldName="Group"
                                     ReadOnly="True"
                                     Visible="False"
                                     Title="グループ">
                        </xcdg:Column>

                    </xcdg:DataGridControl.Columns>



                    <xcdg:DataGridControl.View>


                        <Views:TableView UseDefaultHeadersFooters="False" IsAlternatingRowStyleEnabled="True" VerticalGridLineThickness="1" ShowRowSelectorPane="False">
                            <Views:TableView.FixedHeaders>
                                <!--<DataTemplate>
                                    <xcdg:HierarchicalGroupByControl Views:TableView.CanScrollHorizontally="False" NoGroupContent="列のヘッダをここにドラッグするとグループ化して表示します。" />
                                </DataTemplate>-->
                                <DataTemplate>
                                    <xcdg:ColumnManagerRow />
                                </DataTemplate>
                            </Views:TableView.FixedHeaders>

                        </Views:TableView>
                    </xcdg:DataGridControl.View>
                </xcdg:DataGridControl>

            </DockPanel>
            
            <GridSplitter Grid.Row="1" Grid.RowSpan="1" ResizeDirection="Rows" Width="Auto" Height="4" HorizontalAlignment="Stretch" Margin="0" Background="#FFBFDBFF" />

            <av:AutoGrid Grid.Row="2" x:Name="DetailsGrid">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition MaxWidth="133"  Width="{Binding ElementName=DetailsGrid, Path=ActualHeight}" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>

                <Grid Margin="5 5 8 8" x:Name="ImageGrid">
                    <Button Padding="0" Style="{StaticResource ImageButtonStyle}"
                            Command="{Binding OpenUriCommand}"
                            CommandParameter="{Binding LiveProgramsViewSource.View/Icon.TargetUri}">
                        <Image Source="{Binding LiveProgramsViewSource.View/Station.Icon}" 
                               MaxWidth="120"
                               MaxHeight="120"
                               Width="{Binding ElementName=ImageGrid, Path=ActualHeight}" 
                               Height="{Binding ElementName=ImageGrid, Path=ActualHeight}"
                               Cursor="Hand"
                               >
                            <Image.BitmapEffect>
                                <DropShadowBitmapEffect Softness=".5" ShadowDepth="3" Color="Gray"/>
                            </Image.BitmapEffect>
                        </Image>
                    </Button>
                </Grid>
                
                <av:AutoGrid>
                    <Grid.Style>
                        <Style TargetType="{x:Type av:AutoGrid}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding LiveProgramsViewSource.View/}" Value="{x:Null}">
                                    <Setter Property="Visibility" Value="Collapsed" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </Grid.Style>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <WrapPanel Orientation="Horizontal">
                        <StackPanel Orientation="Horizontal" Margin="3 0 0 0" >
                            <Button Padding="0" Style="{StaticResource ImageButtonStyle}">
                                <Image Source="Images/key_small.png" 
                                       Style="{StaticResource SmallIconStyle}"
                                       Visibility="{Binding Path=LiveProgramsViewSource.View/IsMemberOnly, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}"
                                       Margin="1" />
                            </Button>
                            <Button Padding="0" Style="{StaticResource ImageButtonStyle}">
                                <Image Source="Images/face_small.png" 
                                       Style="{StaticResource SmallIconStyle}"
                                       Visibility="{Binding Path=LiveProgramsViewSource.View/IsFace, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}"
                                       Margin="1" />
                            </Button>
                            <TextBlock Text="{Binding LiveProgramsViewSource.View/Title}" 
                                       Margin="0 0 7 0" 
                                       TextDecorations="Underline"
                                       Cursor="Hand" />
                        </StackPanel>
                        <TextBlock Margin="3 0 0 0" 
                                   Text="{Binding LiveProgramsViewSource.View/Station.Name}"
                                   TextDecorations="Underline"
                                   Cursor="Hand" />
                    </WrapPanel>

                    <WrapPanel Orientation="Horizontal">
                        <StackPanel Orientation="Horizontal" Margin="3 0 0 0">
                            <TextBlock Text="放送者:" Foreground="Gray" Margin="0 0 5 0" />
                            <TextBlock Text="{Binding LiveProgramsViewSource.View/Caster}" Margin="0 0 8 0" />
                            <TextBlock Text="開始時間:" Foreground="Gray" Margin="0 0 5 0" />
                            <TextBlock Text="{Binding LiveProgramsViewSource.View/StartDateTime, StringFormat=HH:mm}" Margin="0 0 8 0" />
                            <TextBlock Text="来場者数:" Foreground="Gray" Margin="0 0 5 0" />
                            <TextBlock Text="{Binding LiveProgramsViewSource.View/VisitorCount}" Margin="0 0 8 0" />
                            <TextBlock Text="コメ数:" Foreground="Gray" Margin="0 0 5 0" />
                            <TextBlock Text="{Binding LiveProgramsViewSource.View/CommentCount}" Margin="0 0 8 0" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="3 0 0 0">
                            <TextBlock Text="評価:" Foreground="Gray" Margin="0 0 5 0" />
                            <southridge:RatingsControl RatingMaximum="5" Rating="{Binding LiveProgramsViewSource.View/Station.Rating, Mode=TwoWay}" Margin="0 0 8 0" />
                        </StackPanel>
                    </WrapPanel>
                    
                    <Border BorderBrush="#FF8DB2E3" BorderThickness="1" Margin="3 3 5 5" CornerRadius="5">
                        <ScrollViewer HorizontalScrollBarVisibility="Disabled"
                                      VerticalScrollBarVisibility="Auto"
                                      HorizontalAlignment="Stretch"
                                      CanContentScroll="True">
                            
                            <TextBox TextWrapping="Wrap" IsReadOnly="True"
                                     Background="Transparent"
                                     BorderThickness="0"
                                     Text="{Binding LiveProgramsViewSource.View/Content}"
                                     Padding="3" />
                        </ScrollViewer>
                    </Border>

                    <WrapPanel Orientation="Horizontal" Margin="3 0 0 5">
                        <StackPanel Orientation="Horizontal" Margin="0">
                            <TextBlock Text="タグ:" Foreground="Gray" Margin="0 0 5 0" VerticalAlignment="Center" />
                            <TextBlock Text="{Binding LiveProgramsViewSource.View/OfficialTag}" Margin="0 0 0 0" VerticalAlignment="Center" />
                        </StackPanel>

                        <ItemsControl Grid.Row="1" ItemsSource="{Binding LiveProgramsViewSource.View/FilterdTags}">
                            <ItemsControl.ItemsPanel>
                                <ItemsPanelTemplate>
                                    <WrapPanel />
                                </ItemsPanelTemplate>
                            </ItemsControl.ItemsPanel>
                            <ItemsControl.ItemTemplate>
                                <DataTemplate>
                                    <WrapPanel Orientation="Horizontal">
                                        <Button Style="{StaticResource ImageButtonStyle}">
                                            <TextBlock Text="{Binding}" Margin="2" TextDecorations="Underline" Cursor="Hand" VerticalAlignment="Center" />
                                        </Button>
                                    </WrapPanel>
                                </DataTemplate>
                            </ItemsControl.ItemTemplate>
                        </ItemsControl>


                        <Button Style="{StaticResource ImageButtonStyle}" Margin="5 0 0 0">
                            <StackPanel Orientation="Horizontal">
                                <Image Source="Images/pencil_small.png" Style="{StaticResource SmallIconStyle}" />    
                                <TextBlock Text="編集" Margin="2"  TextDecorations="Underline" Cursor="Hand" VerticalAlignment="Center" />
                            </StackPanel>
                        </Button>
                    </WrapPanel>

                </av:AutoGrid>
            </av:AutoGrid>
        </Grid>
        


        <av:NotifyIcon x:Name="NotifyIcon" 
                       Icon="Icons/application.ico" 
                       Text="{Binding LivePrograms.Count}"
                       Visibility="Hidden"
                       >
            <av:NotifyIcon.ContextMenu>
                <ContextMenu ItemsSource="{DynamicResource ContextMenuDataContext}" >
                    <ContextMenu.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel>
                                <ItemsPresenter />
                            </StackPanel>
                        </ItemsPanelTemplate>
                    </ContextMenu.ItemsPanel>
                    <ContextMenu.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Title}" />
                        </DataTemplate>
                    </ContextMenu.ItemTemplate>
                    
                   
                    <!--<MenuItem Header="開く"  />
                    <Separator />
                    <MenuItem Header="終了"  />-->
                </ContextMenu>
                
            </av:NotifyIcon.ContextMenu>
        </av:NotifyIcon>


        <!--<ItemsControl ItemsSource="{DynamicResource ContextMenuDataContext}" Margin="5" >
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <WrapPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Title}" />
                    </WrapPanel>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>-->

    </DockPanel>


</r:RibbonWindow>
